﻿#region 命名空间

using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI.WebControls;
using WinnerCMS.BLL.PageFactory;
using WinnerCMS.Common;
using WinnerCMS.Data;
using WinnerCMS.Model;

#endregion

namespace WinnerCMS.BLL
{
    public partial class ConsultantManage
    {
        public void Add(HttpContext current, ref string strErr)
        {
            try
            {
                Consultant model = new Consultant
                {
                    ModelId = byte.Parse(current.Request.Form["ModelId"]),
                    ContentId = int.Parse(current.Request.Form["ContentId"]),
                    ConsultTime = DateTime.Now,
                    Content = current.Request.Form["Content"],
                    UserName = current.Request.Form["Name"]
                };
                if (model.Content.Length == 0)
                {
                    strErr = "“内容”不能为空！";
                }
                else if (model.UserName.Length == 0)
                {
                    strErr = "“用户名”不能为空！";
                }
                else
                {
                    MyDAL.Add(model);
                }
            }
            catch (Exception exception)
            {
                strErr = exception.Message;
            }
        }

        public IList<Consultant> ConsultantShow(string top, byte modelId, string contentId)
        {
            return MyDAL.ConsultantShow(int.Parse(top), modelId, int.Parse(contentId));
        }
    }
}